<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>节流</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.js"></script>
</head>

<body>
    <div>
        <h1>计数器：<span>0</span></h1>
        <button>加一</button>
    </div>
</body>
<script>
    let span = document.querySelector('span');
    let button = document.querySelector('button');
    let count = 0;
    button.onclick = _.throttle(function () {
        count++;
        span.innerHTML = count;
    }, 1000);
</script>

</html>